For extracting the sequence of numbers represented by a barcode, it has been used techniques of image processing and computer vision implemented in a system for decoding barcode. The use of the image obtained with the camera of the portable device requires preprocessing to compensate for eventual problems and even corrections to map the photo originally captured to become a barcode image with no perspective nor rotation, i.e., a rectangular image pattern that is directly decodable.
Several types and standards of barcodes are available, each one with a specific purpose. Some examples are the EAN-13 standard used in commercial products and the Interleaved 2 of 5 Standard used in bank accounts and invoices.
Currently, the standard barcode commonly used to represent commercial products is the EAN-13, which usually represents the country code, the manufacturer code and the product code. Barcodes are present in various commercial means and represent a key item in the automation of control processes of sale and stock. The implementation of barcodes for stock control was so successful that in a short period of time, barcodes began appearing in other scenarios beyond the market: banks, industry, etc.
However, as the amount of information that a bill barcode and bank accounts is greater than the amount of information needed to represent a product, a new standard was developed to meet such specifications. At that moment, it came up the Interleaved 2 of 5 Standard that is able to represent a greater amount of information. In this pattern, it represented the type of account, the value and expiration date.
Barcodes are a graphical representation of a numeric or alphanumeric data set. Data stored in the codes are arranged in a composite image, usually by dark and light bars interleaved. These bars represent information that clearly identify products or services and standardize the way such information is expressed, which evidences the automation process of reading of such information.
The information contained in the barcode is decoded by a barcode reader, which sweeps the image to identify the information represented on the same.
Systems for reading barcodes are often based on optical scanning performed by a device, which consists of a laser device that performs a scan on the image and passes the obtained values to a software. However, this device is not portable.
Barcode reading via infrared is made by a chain of sensors aligned disposed in the head of the reader. These aligned sensors are responsible for reading the barcode, which occurs as follows: each sensor is responsible for measuring the light intensity immediately in front of the same. Thus, through the reflection of energy, the reader indicates one voltage standard that matches the color variation captured by the sensors, enabling the decoding of the numbers represented in the barcode. Infrared reading is one-dimensional because it is performed in a specific line of code only, which increases the error rate if there is noise in the image.
The Brazilian patent document PI 0603273-7, published on Jan. 25, 2008, describes a system and method that uses a software to perform the decoding of barcodes directly to mobile devices equipped with digital cameras. This document describes a method of preprocessing image captured by the device camera to verify the presence of a barcode. This method comprises converting the image into two colors, and then you perform a scan process of the image that aims to convert the same in two colored states. After this procedure is performed, it is carried out the filtering of the information contained in the image. Below, there is provided a parameter to identify the component parts of the image. Then, the component parts are checked to find whether or not a barcode. If the verification is positive, the value represented in the barcode is obtained. The steps taken by the process described in the Brazilian document PI 0603273-7 are not detailed enough. The document PI 0603273-7 presents the state of the art, not adding new elements and does not explain how to solve the problems despite indicating them.
The document U.S. Pat. No. 7,156,311 issued Jan. 2, 2007, describes a system and method for decoding and analyzing barcodes using a mobile device. The barcode information is transmitted to a server using a wireless network and a media content related to barcode is transmitted back to the mobile device. Tilt and rotation corrections are mentioned, as well as aspects related to lighting and focus. Although the US document details the process of identification of the bars, it does not mention the obtainment of efficient process to correct rotation and perspective distortions, in particular taking into account the procedure is repeated until it is obtained a valid decoding.
Bato (“Barcode Toolkit”), http://people.inf.ethz.ch/adelmanr/batoo/index.php/Documentation/Algorithm, ETH Zurich, of 2007, uses multiple scan lines (“scanlines”) to increase the robustness of the process, but it does not use information stacking in each slice to improve signal to noise ratio. It also uses a validation process between multiple scan lines, but it does not use a process of cross validation between multiple stacked cutouts, which is much more robust. The technique used in this document has limitations in respect to barcodes partially crushed or in perspective.
The document “The superresolution approach for barcode reading” by Rusen and Levent Oktem Oktem, 2005, uses a super-resolution method to extract the geometric features of the quadrangles that make up a barcode. Each barcode is a quadrilateral that has width and angle to be estimated. An algorithm for solving non-linear system of equations (Newton-Raphson) is used. This implies a longer processing time, which prevents practical solutions given the processing limitations of portable devices.
The document “Barcode Readers using the Device camera in Mobile Phones” by Eisaku Ohbuchi et al., 2004, presents algorithms and implementations for the reorganization of images of EAN/QR barcodes, using a digital signal processor (DSP) for perform the decoding of barcodes in real time. The described method uses homogeneous coordinates, which implies in a large computational cost, in particular considering that a portable device would not necessarily be equipped with a DSP. There are also mentioned problems due to the threshold between light and dark regions.
The paper “Robust Software Barcode Reader Using the Hough Transform” by Rubén Muñiz et al., November 2009, presents a method based on Hough transform for decoding barcodes. The image containing the lines of a barcode is mapped into another space parameterization in order to increase the robustness of the decoding of barcode in Code 39 and EAN-13 patterns. There is no mention to previous procedures to correct lighting and no considerations are made about how to optimize the processing time, which would be indispensable if it was aimed to implement the described method in a portable device.
The document “Camera-based barcode recognition system using neural net,” by Shu-Jen Liu et al., October 1993, describes a method for decoding barcodes using neural networks. There are mentioned possible problems with the texture of the document that may interfere with the identification of the rectangle containing the barcode.
The document “A Two-Dimensional Barcode Reader” by N. Normand, C. Viard-Gaudin, October 1994, presents a method based on the second derivative to detect the transitions between bars and also to minimize error by the method of least squares. The resulting method requires the use of a workstation due to the high computational cost, which makes its direct application impractical for portable devices.
The above described methods have the ability to decode barcodes in situations closer to the ideal situation or require computational cost incompatible with portable devices. However, they have limitations when it comes to the specific and qualitative treatment executed before the decoding process in order to increase efficiency and effectiveness of the application. The solution described in this invention offers some advantages that aim to increase the robustness of the application offering specific treatment for everyday situations, such as poor lighting, shading, perspective correction, movement detection, automatic detection of the barcode and correction of noise found in the image.
Thus, according to the elements introduced by the present invention, there is provided a method to not only recognize and decode a barcode without the need for deployment of new sensors, but also treat some adverse situations commonly found in barcode images. The method of perspective correction, for example, corrects images captured with tilt angle and perspective. Thus, the remaining operations can be performed with reference to an image without tilting, which reduces the complexity of processing for other processes and increases the success of the application.